﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MegavaniaX.Rendering;
using MegavaniaX.UI;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace MegavaniaX.UI
{
    /// <summary>
    ///  UI Manager class.
    /// </summary>
    public class UIManager
    {
        private ContentManager _contentManager;
        private IList<UIElement> _elements;
        private float _uiZoom;

        public UIManager(ContentManager contentManager)
        {
            _contentManager = contentManager;
            _elements = new List<UIElement>();
            _uiZoom = 3.0f;
        }

        public void AddLifeBar(Player player)
        {
            var lbBg = _contentManager.Load<Texture2D>("ui/lifebarbg");
            var lbFill = _contentManager.Load<Texture2D>("ui/lifebar");
            _elements.Add(new Lifebar(player, lbBg, lbFill));
        }

        public void Draw(SpriteBatch batch)
        {
            foreach (var element in _elements)
                element.Draw(batch, _uiZoom);
        }

    }
}
